/* Created by Aquariuslt on 5/20/17.*/


navbarController.$inject = ['$state','navMenuService'];
function navbarController($state,navMenuService) {
    var vm = this;
    vm.menus = navMenuService.getMenus();
    vm.isLogin = false;

    vm.checkLogin = function(){
        navMenuService.isLogin().then(function(data){
            if(data.data){
                vm.sysuser = sessionStorage.sysuser;
                vm.isLogin = data.data;
            }else{
                vm.isLogin = data.data;
                $state.go("login");
            }
        });
    }

    vm.logout = function(){
        navMenuService.logout().then(function(data){
            console.log(data);
            if(data.data){
                delete sessionStorage.sysuser;
                $state.go("login");
            }
        });
    }
}

module.exports = navbarController;